@namespace MudBlazor.Docs.Examples

<MudPaper Width="400px" Elevation="2">
    <MudTreeView Items="@TreeItems" Hover="true">
        <ItemTemplate Context="item">
            <MudTreeViewItem Items="@item.Children" Icon="@item.Icon">
                <BodyContent>
                    <div style="display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%">
                        <MudText Style="justify-self: start;">@item.Text</MudText>
                        <div style="justify-self: end;">
                            <MudIconButton Icon="@Icons.Material.Filled.Edit" Size="Size.Medium" Color="Color.Inherit" />
                            <MudIconButton Icon="@Icons.Material.Filled.Delete" Size="Size.Medium" Color="Color.Inherit" />
                        </div>
                    </div>
                </BodyContent>
            </MudTreeViewItem>
        </ItemTemplate>
    </MudTreeView>
</MudPaper>

@code {

    private List<TreeItemData<string>> TreeItems { get; set; } = [];

    public class TreeItemData : TreeItemData<string>
    {
        public TreeItemData(string text, string icon) : base(text)
        {
            Text = text;
            Icon = icon;
        }
    }

    protected override void OnInitialized()
    {
        TreeItems.Add(new TreeItemData(".github", Icons.Custom.Brands.GitHub));
        TreeItems.Add(new TreeItemData(".vscode", Icons.Custom.Brands.MicrosoftVisualStudio));
        TreeItems.Add(new TreeItemData("content", Icons.Custom.FileFormats.FileDocument));
        TreeItems.Add(new TreeItemData("src", Icons.Custom.FileFormats.FileCode) {
                Children = [
                    new TreeItemData("MudBlazor", Icons.Custom.Brands.MudBlazor),
                    new TreeItemData("MudBlazor.Docs", Icons.Custom.FileFormats.FileDocument) {
                        Children = [
                            new TreeItemData("_Imports.razor", Icons.Material.Filled.AlternateEmail),
                            new TreeItemData("compilerconfig.json", Icons.Custom.FileFormats.FileImage),
                            new TreeItemData("MudBlazor.Docs.csproj", Icons.Custom.Brands.MicrosoftVisualStudio),
                            new TreeItemData("NewFilesToBuild.txt", Icons.Custom.FileFormats.FileDocument)
                        ]
                    },

                    new TreeItemData("MudBlazor.Docs.Client", Icons.Material.Filled.Folder),
                    new TreeItemData("MudBlazor.Docs.Compiler", Icons.Material.Filled.Folder),
                    new TreeItemData("MudBlazor.Docs.Server", Icons.Material.Filled.Folder),
                    new TreeItemData("MudBlazor.UnitTests", Icons.Material.Filled.Folder),
                    new TreeItemData(".editorconfig", Icons.Custom.FileFormats.FileCode),
                    new TreeItemData("MudBlazor.sln", Icons.Custom.Brands.MicrosoftVisualStudio)
                ]
        });
        TreeItems.Add(new TreeItemData("History", Icons.Material.Filled.Folder));
    }
}
